<?php
namespace app\admin\validate;

use think\Validate;

class Project extends Validate
{
    protected $rule = [
        'project_name' => 'require|unique:project',
        'target_code' => 'require',
        'min_code' => 'lt:target_code',
        'max_code' => 'gt:min_code',
        'start_time' => 'require',
        'end_time' => 'require',
        'end_time' => 'gt:start_time',
        'release_time' => 'gt:end_time',
        'create_time'=>'require',
        'picture' => 'require',
        'thumb' => 'require',
        'des' => 'require',
        'detail' => 'require',
        'agreeNotice' => 'requireIf:status,-2',
        'single_num' => 'requireIf:project_type,2',
        'single_mon' => 'requireIf:project_type,2',
    ];

    protected $message = [
        'project_name.require' => '{%project_name_val}',
        'project_name.unique' => '{%project_name_unique}',
        'target_code.require' => '{%target_code_val}',
        'start_time.require' => '{%start_time_val}',
        'end_time.require' => '{%end_time_val}',
        'create_time.require' => '请在最下方选择创建时间',
        'picture.require' => '请上传项目缩略图',
        'thumb.require' => '{%thumb_val}',
        'des.require' => '{%des_val}',
        'detail.require' => '{%detail_val}',
        'end_time.gt' => '{%end_time_gt}',
        'release_time.gt' => '{%release_time_gt}',
        'min_code.lt' => '{%min_code_gt}',
        'max_code.gt' => '{%max_code_gt}',
        'agreeNotice.requireIf' => '请输入审核备注',
        'single_num.requireIf' => '份额时必填',
        'single_mon.requireIf' => '份额时必填',
    ];

    protected $scene = [
        'add'   => ['project_name','target_code','min_code','max_code','start_time','end_time','create_time','picture','thumb','release_time','des','detail','single_num','single_mon'],
        'edit'  => ['project_name','target_code','start_time','end_time','picture','thumb','des','detail','single_num','single_mon'],
		'status' => ['status'],
		'project_name' => ['project_name'],
		'top'	=> ['top'],
		'agreeNotice'	=> ['agreeNotice'],
    ];
}